<% @page_title = "Edit borrow rule" %>
<%= stylesheet_link_tag "admin/form", :media => "all" %>

<div class="edit-user">
	<h1>Edit borrow rule</h1>
	<%= form_for :borrow_rule,
	:url => {:controller => "admin/borrow_rule", :action => "update", :id => @borrow_rule.id},
	:method => "put" do |f| %>
		<p>
			<label>Reader group</label>
			<%= collection_select(:borrow_rule, :role_id, Role.all, :id, :role_name, {:selected => @borrow_rule.role_id}) %>
		</p>
		<p>
			<label>Max number of books:</label>
			<%= f.number_field :max_book %>
		</p>
    	<p>
    		<label>Number of day to borrow:</label> 
    		<%= f.number_field :borrow_time %>
    	</p>
    	<p>
    		<label>Number of day to extend:</label> 
    		<%= f.number_field :extended_time %>
    		</p>
    	<p>
    		<label>Punished money:</label>
    		<%= f.number_field :punish_money%>
    	</p>
		
		<p class="action">
		   	<label>&nbsp;</label><%= submit_tag "Save Changes" %><%= link_to "Back", :controller => "admin/borrow_rule", :action => "index" %>
		</p>
	<% end %><!-- End form -->
</div><!-- End .edit-borrow-rule -->

<div class='clear'></div>

<% if @borrow_rule.errors.any? %>
	<ul>
	<% @borrow_rule.errors.full_messages.each do |msg| %>
		<li>&nbsp;<%= msg %></li>
	<% end %>
	</ul>
<% end %><!-- End if -->